﻿//
// 请注意：bbsmax 不是一个免费产品，源代码仅限用于学习，禁止用于商业站点或者其他商业用途
// 如果您要将bbsmax用于商业用途，需要从官方购买商业授权，得到授权后可以基于源代码二次开发
//
// 版权所有 厦门麦斯网络科技有限公司
// 公司网站 www.bbsmax.com
//

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;

using MaxLabs.WebEngine;
using MaxLabs.bbsMax.Errors;
using MaxLabs.bbsMax.Settings;

namespace MaxLabs.bbsMax.Web.max_dialogs
{
    public partial class announcement_delete : AdminDialogPageBase
    {
        protected override BackendPermissions.Action BackedPermissionAction
        {
            get { return BackendPermissions.Action.Manage_Announcement; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (_Request.IsClick("delete"))
            {
                DeleteAnnouncement();
            }
        }

        protected string PostAnnouncementIdArray
        {
            get
            {
                return _Request.Get("Announcementids", Method.Post);
            }
        }

        protected void DeleteAnnouncement()
        {
            if (!string.IsNullOrEmpty( _Request.Get("announcementid",Method.Get)))
            {
                int annId = _Request.Get<int>("announcementid", Method.Get, 0);
                AnnouncementBO.Instance.DeleteAnnouncement(MyUserID, annId);
                Return(annId);
            }
            else
            {
                int[] ids = StringUtil.Split<int>(_Request.Get("Announcementids", Method.Post));
                AnnouncementBO.Instance.DeleteAnnouncements(MyUserID, ids);
                Return(ids);
            }

            //TODO 返回已经删除
        }
    }
}